package javabase.schoolwork.day5_31;

/**
 * @author fance
 * @date 2018/5/31 21:35
 */
public class EcmDemo {

    public static void main(String[] args) throws MyEcDef {
        try {
            Double a = Double.parseDouble(args[0]);
            Double b = Double.parseDouble(args[1]);
            if (a < 0 || b < 0) {
                throw new MyEcDef("不能输入负数");
            }
            div(a,b);
        } catch (NumberFormatException e) {
            System.out.println("NumberFormatException");
        } catch (ArrayIndexOutOfBoundsException e) {
            System.out.println("ArrayIndexOutOfBoundsException");
        } catch (ArithmeticException e) {
            System.out.println("ArithmeticException");
        }
    }
    public static double div(double a,double b) {
        return a / b;
    }
}
